import { set } from "nprogress"

const useWebSocketStore = defineStore(
  'websockets',
  {
    state: () => ({
      isAutoAnswer: false,//是否自动接听
      callDuration: "00:00",
      isCalling: false,//是否正在通话
      jietingFlag: false,//接听状态
      laidianFlag: false,
      incomingCaller: "",//来电号码
      currentInvitation: "",//当前通话邀请
      btmJujie: false,//拒接来电
      jieting: false,//接听状态
      guaduan: false,//挂断
      hujiao: false,//呼叫
      hujiaoFlag: false,//呼叫状态
      targetNumber: ""//目标号码
    }),
    actions: {
      setIsAutoAnswer(isAutoAnswer) {
        this.isAutoAnswer = isAutoAnswer
      },
      setCallDuration(callDuration) {
        this.callDuration = callDuration
      },
      setIsCalling(isCalling) {
        this.isCalling = isCalling
      },
      setjietingFlag(jietingFlag) {
        this.jietingFlag = jietingFlag
      },
      setlaidians(laidianFlag) {
        this.laidianFlag = laidianFlag
      },
      setIncomingCaller(incomingCaller) {
        this.incomingCaller = incomingCaller
      },
      setCurrentInvitation(currentInvitation) {
        this.currentInvitation = currentInvitation
      },
      setBtmJujie(btmJujie) {
        this.btmJujie = btmJujie
      },
      setJieting(jieting) {
        this.jieting = jieting
      },
      setGuaduan(guaduan) {
        this.guaduan = guaduan
      },
      setHujiao(hujiao) {
        this.hujiao = hujiao
      },
      setHujiaoFlag(hujiaoFlag) {
        this.hujiaoFlag = hujiaoFlag
      },
      setTargetNumber(targetNumber) {
        this.targetNumber = targetNumber
      }
    }
  })

export default useWebSocketStore